package java_thinking.unit_21._21_5;

import java.util.concurrent.CountDownLatch;

/**
 * @Desc:
 * @author: cww
 * @DateTime: 2020/5/13 10:56
 */

public class TestCountDown {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch templateLatch = new CountDownLatch(2);
        int i = -1;
        if (i>-2){

            // 执行外部匹配组计算

        } else {
            System.out.println("1");
            // 匹配组为空直接过
            templateLatch.countDown();
        }

        if (i>0){

            // 执行内部匹配组计算

        } else {
            System.out.println("2");
            // 匹配组为空直接过
            templateLatch.countDown();
        }
        // 两组计算完成继续
        templateLatch.await();
        System.out.println("end");
    }
}
